package com.yuwei.router

import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.yuwei.base.path.RouterPath

/**
 * 局部降级策略
 */
class LocalDegradeCallback(private val path : String = "",private val group : String = "") : NavigationCallback{
    /**
     * 匹配到目标页面
     */
    override fun onFound(postcard: Postcard?) {

    }

    /**
     * 没有匹配到目标页面
     */
    override fun onLost(postcard: Postcard?) {

    }

    /**
     * 页面跳转成功
     */
    override fun onArrival(postcard: Postcard?) {
        postcard?.group = if(group.isEmpty())group else RouterPath.EMPTY_GROUP
        postcard?.path = if(path.isEmpty())path else RouterPath.MODULE_EMPTY_ACTIVITY
        postcard?.navigation()
    }

    /**
     * 页面跳转被拦截
     */
    override fun onInterrupt(postcard: Postcard?) {

    }
}